<?php

/**
 * Class CustomerUserRoleLogic
 */
class CustomerUserRoleLogic extends Model
{
    private $_modelCustomerUserRole = null;
    private $_customerId = null;

    public function __construct()
    {
        $this->_customerId = Session::$user['customerId'];
        Session::switchCustomer(0);

        $this->_modelCustomerUserRole = D('CustomerUserRole');

        Session::switchCustomer($this->_customerId);
    }

    /** --------------------------------------  增  -------------------------------------- */
    /** --------------------------------------  删  -------------------------------------- */

    /**
     * 根据roleId删除拥有该role的用户
     *
     * @param $roleId
     * @return mixed
     */
    public function deleteByRoleId($roleId)
    {
        return $this->_modelCustomerUserRole->where(['cid' => $this->_customerId, 'roleId' => $roleId])->delete();
    }

    /** --------------------------------------  改  -------------------------------------- */
    /** --------------------------------------  查  -------------------------------------- */


}